<%--
  Created by IntelliJ IDEA.
  User: 陈敏琴
  Date: 2025/10/26
  Time: 17:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>员工信息管理系统 - 员工详情</title>
    <link rel="stylesheet" href="../css/style.css">
</head>
<body>
<header>
    <div class="logo">员工信息管理系统</div>
    <div class="user-info">
        <span>欢迎, <%= ((com.cmq.web_1.employeemanage.User) session.getAttribute("user")).getUsername() %></span>
        <a href="../logout" class="logout-btn">退出登录</a>
    </div>
</header>

<nav>
    <ul>
        <li><a href="../dashboard">仪表盘</a></li>
        <li><a href="list" class="active">员工管理</a></li>
    </ul>
</nav>

<main>
    <div class="detail-container">
        <h2>员工详情</h2>

        <%
            com.cmq.web_1.employeemanage.Employee employee =
                    (com.cmq.web_1.employeemanage.Employee) request.getAttribute("employee");
            if (employee == null) {
                response.sendRedirect("list");
                return;
            }

        %>

        <div class="detail-header">
            <h3><%= employee.getName() %> 的详细信息</h3>
            <div class="action-buttons">
                <a href="edit?id=<%= employee.getId() %>" class="btn edit-btn">编辑</a>
                <a href="delete?id=<%= employee.getId() %>" class="btn delete-btn"
                   onclick="return confirm('确定要删除该员工吗？此操作不可恢复！')">删除</a>
                <a href="list" class="btn">返回列表</a>
            </div>
        </div>

        <div class="detail-content">
            <div class="detail-row">
                <div class="detail-label">ID:</div>
                <div class="detail-value"><%= employee.getId() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">姓名:</div>
                <div class="detail-value"><%= employee.getName() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">部门:</div>
                <div class="detail-value"><%= employee.getDepartment() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">职位:</div>
                <div class="detail-value"><%= employee.getPosition() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">薪资:</div>
                <div class="detail-value"><%= employee.getSalary() %> 元</div>
            </div>

            <div class="detail-row">
                <div class="detail-label">邮箱:</div>
                <div class="detail-value"><%= employee.getEmail() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">电话:</div>
                <div class="detail-value"><%= employee.getPhone() %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">入职日期:</div>
                <div class="detail-value"><%= new java.text.SimpleDateFormat("yyyy-MM-dd").format(employee.getHireDate()) %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">创建时间:</div>
                <div class="detail-value"><%= new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(employee.getCreatedAt()) %></div>
            </div>

            <div class="detail-row">
                <div class="detail-label">最后更新时间:</div>
                <div class="detail-value"><%= new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(employee.getUpdatedAt()) %></div>
            </div>
        </div>
    </div>
</main>

<footer>
    <p>&copy; 2023 员工信息管理系统 版权所有</p>
</footer>
</body>
</html>
